This archive contains the code and data files necessary to replicate the results reported in "Computer assisted text analysis for comparative politics".

Note the following:
[1] The original text data cannot be shared for privacy reasons, so we share the DTMs and metadata. 
[2] To replicate the exact results reported in the paper, make sure you have the same version of stm installed. You can do so with the following code.

library(devtools)
install_version(version = '1.0.6', repo = 'stm', username = 'bstewart') 

The files contained in this archive are as follows:

########
# DATA #
########

# Snowden
Prepped.Translated.Docs.RData contains the translated tweets (text translation, not DTM translation)
Prepped.Translated.Docs_TermByTerm.RData contains the translated DTM

SnowdenC-noRT.RData contains the data with the content covariate for text translation
SnowdennoC-noRT.RData contains the data without the content covariate for text translation

SnowdenC-noRT-TermByTerm.RData contains the data for term-by-term translation

# Fatwas 
jihad_metadata_edited.csv contains the metadata for the Nielsen example. 
CombinedLuceneREPLICATION.RData is the Lucene object feeding into the STM model
RichCheck102314-SM.RData is the stm object after running the STM

###########
# R FILES #
###########

# Snowden
analysis_replication.R runs the models for the Snowden example
results_replication.R creates all the plots for the Snowden example

# Fatwas
fatwa_replication_public.R runs the models and creates the plots for the fatwas example. 
